package com.kidult.android.common.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ScrollView;

public class PullToRefreshScrollView extends PullToRefreshBase<ScrollView> {

    public PullToRefreshScrollView(Context context) {
	super(context);
    }

    public PullToRefreshScrollView(Context context, AttributeSet attrs) {
	super(context, attrs);
    }

    @Override
    protected com.kidult.android.common.view.PullToRefreshBase.CurrentPositionEnum judgeCurrentPosition() {
	View scrollViewChild = mPullableView.getChildAt(0);
	if (null != mPullableView && null != scrollViewChild)
	    return mPullableView.getScrollY() == 0 ? CurrentPositionEnum.TOP
		    : (mPullableView.getScrollY() >= (scrollViewChild.getHeight() - getHeight()) ? CurrentPositionEnum.BOTTOM
			    : CurrentPositionEnum.MIDDLE);
	return CurrentPositionEnum.MIDDLE;
    }

    @Override
    protected ScrollView createPullableView(Context context) {
	ScrollView sv = new ScrollView(context);
	sv.setId(android.R.id.list);
//	sv.setOnTouchListener(new MyListViewTouchListener());
	return sv;
    }

}
